@extends('backend.layouts.main')
@section('content')
    <link rel="stylesheet" href="{{URL::asset('backend/AdminLTE/plugins/select2/select2.min.css')}}">
    <script type="text/javascript" src="{{URL::asset('backend/js/my97/WdatePicker.js')}}"></script>
    <!-- Select2 -->
    <script type="text/javascript"
            src="{{URL::asset('backend/AdminLTE/plugins/select2/select2.full.min.js')}}"></script>
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">设置次数</h3>
            </div>
            <form method="POST" action="{{URL('admin/student/')."/".encryptionUrl($studentData->id)}}">
                {{ method_field('PUT') }}
                {{ csrf_field() }}
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputWarning">真实姓名</label>
                        <input type="text" class="form-control" name="real_name" readonly="readonly"
                               value="{{ $studentData->real_name}}">
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">用户昵称</label>
                        <input type="text" class="form-control" name="nickname" readonly="readonly"
                               value="{{ $studentData->nickname}}">
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">用户识别id</label>
                        <input type="text" class="form-control" name="open_id" readonly="readonly"
                               value="{{ $studentData->open_id}}">
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">头像</label>
                        <img src="{{$studentData->images}}" style="width: 150px;height:150px">
                        <div class="info">图片.jpg</div>
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">手机号</label>
                        <input type="text" class="form-control" name="phone" readonly="readonly"
                               value="{{ $studentData->phone??0}}">
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">地区</label>
                        <input type="text" class="form-control" readonly="readonly" name="address"
                               value="{{ $studentData->country}}-{{$studentData->province}}-{{$studentData->city}} ">
                    </div>

                    <div class="form-group">
                        <label for="inputWarning">性别:</label>
                        @if($studentData->sex==1)
                            男
                        @endif
                        @if($studentData->sex==2)
                            女
                        @endif
                        @if($studentData->sex==3)
                            未知
                        @endif
                    </div>
                    <div class="form-group">
                        <div class="radio">
                            <label>
                                <input type="radio" name="status" id="tuanke" value="0" checked>团课
                            </label>
                            <label>
                                <input type="radio" name="status" id="sijiao" value="1">私教
                            </label>
                        </div>
                    </div>
                    <div class="form-group" id="vips" style="display: none">
                        <div class="radio">
                            <label>
                                <input type="radio" name="vips" id="no_vip" value="0" checked>普通
                            </label>
                            <label>
                                <input type="radio" name="vips" id="is_vip" value="1">会员
                            </label>
                        </div>
                    </div>
                    <div class="form-group" id="sike">
                        <label>私教选择</label>
                        <select name="sijiao" class="form-control select2" data-placeholder="私教课程" style="width: 100%;">
                            @foreach($dancesList AS $key=>$val)
                                <option value="{{$val['id']}}">{{$val['name']}}</option>
                            @endforeach
                        </select>
                        @if ($errors->has('sijiao'))
                            <span class="help-block">
                        <strong style="color: #a94442;">{{ $errors->first('sijiao') }}</strong>
                    </span>
                        @endif
                    </div>
                    <div class="form-group" id="league">
                        <label>团课课程</label>
                        <select name="league" class="form-control select2" data-placeholder="团课课程" style="width: 100%;">
                            @foreach($dances AS $key=>$val)
                                <option value="{{$key}}">{{$val}}
                                </option>
                            @endforeach
                        </select>
                        @if ($errors->has('league'))
                            <span class="help-block">
                        <strong style="color: #a94442;">{{ $errors->first('league') }}</strong>
                    </span>
                        @endif
                    </div>
                    <div class="form-group" id="member_number">
                        <label for="inputWarning">购买次数</label>
                        <input type="text" class="form-control" name="member_number" value="">
                        @if ($errors->has('member_number'))
                            <span class="help-block">
                        <strong style="color: #a94442;">{{ $errors->first('member_number') }}</strong>
                    </span>
                        @endif
                    </div>
                    <div id="by_time">
                        <div class="form-group">
                            <label for="inputWarning">会员开始时间</label>
                            <input class="Wdate" type="text" autocomplete="off" name="begin_time" placeholder="请选择日期"
                                   id="begin_time" onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:ss'})">
                            @if ($errors->has('begin_time'))
                                <span class="help-block">
                            <strong style="color: #a94442;">{{ $errors->first('begin_time') }}</strong>
                        </span>
                            @endif
                        </div>
                        <div class="form-group">
                            <label for="inputWarning">会员结束时间</label>
                            <input class="Wdate" type="text" autocomplete="off" name="end_time" placeholder="请选择日期"
                                   id="end_time" onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:ss'})">
                            @if ($errors->has('end_time'))
                                <span class="help-block">
                            <strong style="color: #a94442;">{{ $errors->first('end_time') }}</strong>
                        </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">费用金额</label>
                        <input type="text" class="form-control" name="amount" value="{{ $studentData->amount??""}}">
                    </div>
                    @if ($errors->has('amount'))
                        <span class="help-block">
                    <strong style="color: #a94442;">{{ $errors->first('amount') }}</strong>
                </span>
                    @endif
                </div>
                <div class="form-group">
                    <input type="hidden" class="form-control" name="images" value="{{$studentData->tmpImages}}"
                           id="imagesId">
                </div>
                <div class="box-footer">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
    <script>
        $("#by_time").hide();
        $("#sike").hide();
        $("#sijiao").on('click', function () {
            $("#sike").show();
            // $("#member_number").hide();
            $("#by_time").hide();
            $("#vips").hide();
            $("#league").hide();
        });
        $("#tuanke").on('click', function () {
            $("#member_number").show();
            $("#sike").hide();
            $("#by_time").show();
            if ($('#no_vip').is(':checked')) {
                $("#by_time").hide();
                $("#league").show();
            }
            // $("#vips").show();
        });
        $("#is_vip").on('click', function () {
            $("#by_time").show();
            $("#league").hide();
        });
        $("#no_vip").on('click', function () {
            $("#by_time").hide();
            $("#league").show();
        });
        // lay('#version').html('-v' + laydate.v);
        //执行一个laydate实例
        // var beginTime = laydate.render({
        //     type: 'datetime',
        //     elem: '#begin_time', //指定元素
        //
        //     ready: function (date) {
        //         //将上面的属性赋值给此对象方法
        //         lay.extend(beginTime.config.dateTime, {
        //             hours: 00,
        //             minutes: 00,
        //             seconds: 00,
        //         });
        //     }
        // });
        //
        // var endTime = laydate.render({
        //     type: 'datetime',
        //     elem: '#end_time', //指定元素
        //     ready: function (date) {
        //         //将上面的属性赋值给此对象方法
        //         lay.extend(endTime.config.dateTime, {
        //             hours: 23,
        //             minutes: 59,
        //             seconds: 59,
        //         });
        //     }
        // });
        $(function () {
            //Initialize Select2 Elements
            $(".select2").select2();
        });
    </script>
@endsection
